package ui2;

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import java.awt.Font;

import javax.swing.ButtonGroup;
import javax.swing.JSeparator;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import java.awt.Choice;
import javax.swing.JButton;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class PanelTask extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7311580152070694101L;
	private JFrame frame;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					PanelTask window = new PanelTask();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public PanelTask() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 800, 550);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		//JPanel panel = new JPanel();
		frame.getContentPane().add(this, BorderLayout.CENTER);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{1, 40, 54, 117, 88, 68, 117, 44, 59, 157, 40, 0};
		gbl_panel.rowHeights = new int[]{30, 17, 2, 36, 17, 2, 25, 2, 47, 17, 2, 0, 20, 26, 59, 25, 0};
		gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		this.setLayout(gbl_panel);
		
		JSeparator separator_4 = new JSeparator();
		GridBagConstraints gbc_separator_4 = new GridBagConstraints();
		gbc_separator_4.anchor = GridBagConstraints.WEST;
		gbc_separator_4.fill = GridBagConstraints.VERTICAL;
		gbc_separator_4.insets = new Insets(0, 0, 5, 5);
		gbc_separator_4.gridx = 0;
		gbc_separator_4.gridy = 0;
		this.add(separator_4, gbc_separator_4);
		
		JLabel label = new JLabel("Insert a task and set Nodes than can be able to execute it");
		label.setForeground(Color.RED);
		label.setFont(new Font("Tahoma", Font.BOLD, 15));
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.fill = GridBagConstraints.VERTICAL;
		gbc_label.insets = new Insets(0, 0, 5, 5);
		gbc_label.gridwidth = 8;
		gbc_label.gridx = 2;
		gbc_label.gridy = 1;
		this.add(label, gbc_label);
		
		JSeparator separator = new JSeparator();
		GridBagConstraints gbc_separator = new GridBagConstraints();
		gbc_separator.fill = GridBagConstraints.BOTH;
		gbc_separator.insets = new Insets(0, 0, 5, 5);
		gbc_separator.gridwidth = 8;
		gbc_separator.gridx = 2;
		gbc_separator.gridy = 2;
		this.add(separator, gbc_separator);
		
		JLabel lblInsertTask = new JLabel("INSERT TASK");
		lblInsertTask.setFont(new Font("Tahoma", Font.PLAIN, 16));
		GridBagConstraints gbc_lblInsertTask = new GridBagConstraints();
		gbc_lblInsertTask.fill = GridBagConstraints.VERTICAL;
		gbc_lblInsertTask.insets = new Insets(0, 0, 5, 5);
		gbc_lblInsertTask.gridwidth = 2;
		gbc_lblInsertTask.gridx = 5;
		gbc_lblInsertTask.gridy = 4;
		this.add(lblInsertTask, gbc_lblInsertTask);
		
		JSeparator separator_1 = new JSeparator();
		GridBagConstraints gbc_separator_1 = new GridBagConstraints();
		gbc_separator_1.fill = GridBagConstraints.BOTH;
		gbc_separator_1.insets = new Insets(0, 0, 5, 5);
		gbc_separator_1.gridwidth = 8;
		gbc_separator_1.gridx = 2;
		gbc_separator_1.gridy = 5;
		this.add(separator_1, gbc_separator_1);
		
		JRadioButton radioButton = new JRadioButton("Enqueue :");
		radioButton.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_radioButton = new GridBagConstraints();
		gbc_radioButton.fill = GridBagConstraints.VERTICAL;
		gbc_radioButton.insets = new Insets(0, 0, 5, 5);
		gbc_radioButton.gridx = 3;
		gbc_radioButton.gridy = 6;
		this.add(radioButton, gbc_radioButton);
		
		textField = new JTextField();
		textField.setColumns(10);
		GridBagConstraints gbc_textField = new GridBagConstraints();
		gbc_textField.fill = GridBagConstraints.VERTICAL;
		gbc_textField.insets = new Insets(0, 0, 5, 5);
		gbc_textField.gridwidth = 4;
		gbc_textField.gridx = 3;
		gbc_textField.gridy = 6;
		this.add(textField, gbc_textField);
		
		JRadioButton radioButton_1 = new JRadioButton("Dequeue");
		radioButton_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_radioButton_1 = new GridBagConstraints();
		gbc_radioButton_1.anchor = GridBagConstraints.WEST;
		gbc_radioButton_1.fill = GridBagConstraints.VERTICAL;
		gbc_radioButton_1.insets = new Insets(0, 0, 5, 5);
		gbc_radioButton_1.gridwidth = 2;
		gbc_radioButton_1.gridx = 8;
		gbc_radioButton_1.gridy = 6;
		this.add(radioButton_1, gbc_radioButton_1);
		
		ButtonGroup group = new ButtonGroup();
    	group.add(radioButton);
    	group.add(radioButton_1);
		
		JSeparator separator_2 = new JSeparator();
		GridBagConstraints gbc_separator_2 = new GridBagConstraints();
		gbc_separator_2.fill = GridBagConstraints.BOTH;
		gbc_separator_2.insets = new Insets(0, 0, 5, 5);
		gbc_separator_2.gridwidth = 8;
		gbc_separator_2.gridx = 2;
		gbc_separator_2.gridy = 7;
		this.add(separator_2, gbc_separator_2);
		
		JLabel lblFilter = new JLabel("FILTER");
		lblFilter.setFont(new Font("Tahoma", Font.PLAIN, 16));
		GridBagConstraints gbc_lblFilter = new GridBagConstraints();
		gbc_lblFilter.gridwidth = 2;
		gbc_lblFilter.fill = GridBagConstraints.VERTICAL;
		gbc_lblFilter.insets = new Insets(0, 0, 5, 5);
		gbc_lblFilter.gridx = 5;
		gbc_lblFilter.gridy = 10;
		this.add(lblFilter, gbc_lblFilter);
		
		JSeparator separator_3 = new JSeparator();
		GridBagConstraints gbc_separator_3 = new GridBagConstraints();
		gbc_separator_3.fill = GridBagConstraints.BOTH;
		gbc_separator_3.insets = new Insets(0, 0, 5, 5);
		gbc_separator_3.gridwidth = 8;
		gbc_separator_3.gridx = 2;
		gbc_separator_3.gridy = 11;
		this.add(separator_3, gbc_separator_3);
		
		JLabel label_3 = new JLabel("CPU");
		label_3.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_label_3 = new GridBagConstraints();
		gbc_label_3.anchor = GridBagConstraints.EAST;
		gbc_label_3.insets = new Insets(0, 0, 5, 5);
		gbc_label_3.gridx = 2;
		gbc_label_3.gridy = 13;
		this.add(label_3, gbc_label_3);
		
		Choice choice = new Choice();
		choice.setFont(new Font("Tahoma", Font.PLAIN, 13));
		choice.addItem("Anything");
    	choice.addItem("1 core");
    	choice.addItem("2 core");
    	choice.addItem("4 core");
    	choice.addItem("More");
		GridBagConstraints gbc_choice = new GridBagConstraints();
		gbc_choice.anchor = GridBagConstraints.NORTH;
		gbc_choice.fill = GridBagConstraints.HORIZONTAL;
		gbc_choice.insets = new Insets(0, 0, 5, 5);
		gbc_choice.gridx = 3;
		gbc_choice.gridy = 13;
		this.add(choice, gbc_choice);
		
		JLabel label_4 = new JLabel("Frequency");
		label_4.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_label_4 = new GridBagConstraints();
		gbc_label_4.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_4.insets = new Insets(0, 0, 5, 5);
		gbc_label_4.gridx = 5;
		gbc_label_4.gridy = 13;
		this.add(label_4, gbc_label_4);
		
		Choice choice_1 = new Choice();
		choice_1.setFont(new Font("Tahoma", Font.PLAIN, 13));
		GridBagConstraints gbc_choice_1 = new GridBagConstraints();
		choice_1.addItem("Anything");
    	choice_1.addItem(" < 1 GHz");
    	choice_1.addItem("1 GHz - 2GHz");
    	choice_1.addItem(" > 2 GHz");
		gbc_choice_1.anchor = GridBagConstraints.NORTH;
		gbc_choice_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_choice_1.insets = new Insets(0, 0, 5, 5);
		gbc_choice_1.gridx = 6;
		gbc_choice_1.gridy = 13;
		this.add(choice_1, gbc_choice_1);
		
		JLabel label_5 = new JLabel("Memory");
		label_5.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_label_5 = new GridBagConstraints();
		gbc_label_5.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_5.insets = new Insets(0, 0, 5, 5);
		gbc_label_5.gridx = 8;
		gbc_label_5.gridy = 13;
		this.add(label_5, gbc_label_5);
		
		Choice choice_2 = new Choice();
		choice_2.setFont(new Font("Tahoma", Font.PLAIN, 13));
		choice_2.addItem("Anything");
    	choice_2.addItem("512 MB");
    	choice_2.addItem("1 GB");
    	choice_2.addItem("2 GB");
    	choice_2.addItem("More");
		GridBagConstraints gbc_choice_2 = new GridBagConstraints();
		gbc_choice_2.anchor = GridBagConstraints.NORTH;
		gbc_choice_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_choice_2.insets = new Insets(0, 0, 5, 5);
		gbc_choice_2.gridx = 9;
		gbc_choice_2.gridy = 13;
		this.add(choice_2, gbc_choice_2);
		
		JButton button = new JButton("SEND");
		button.setFont(new Font("Tahoma", Font.PLAIN, 14));
		GridBagConstraints gbc_button = new GridBagConstraints();
		gbc_button.fill = GridBagConstraints.BOTH;
		gbc_button.insets = new Insets(0, 0, 0, 5);
		gbc_button.gridwidth = 2;
		gbc_button.gridx = 5;
		gbc_button.gridy = 15;
		this.add(button, gbc_button);
	}

}
